<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('所有付款数据')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								<label style="width: 100px;">代理编号：</label>
								<input type="text" name="merno"/>
							</li>
							<li>
								<label style="width: 100px;">代理名称：</label>
								<input type="text" name="mer_name"/>
							</li>
							<li>
								<label style="width: 100px;">打款流水：</label>
								<input type="text" name="settle_serial"/>
							</li>
							<li>
								<label style="width: 100px;">出款状态：</label>
								<select name="settle_state">
									<option value="">请选择</option>
									<option value="1">出款成功</option>
									<option value="-4">出款打回</option>
									<option value="0">待处理</option>
									<option value="-1">已上送</option>
									<option value="-2">出款失败</option>
									<option value="-3">冻结</option>
								</select>
							</li>
							<li>
								<label style="width: 100px;">结算卡号：</label>
								<input type="text" name="screen_num"/>
							</li>
							<li>
								<label style="width: 100px;">结算人：</label>
								<input type="text" name="screen_name"/>
							</li>
							<li>
								<label style="width: 100px;">账户类型：</label>
								<select name="acc_type">
									<option value="">请选择</option>
									<option value="1">分润账户</option>
									<option value="2">返现账户</option>
									<option value="3">通讯费账户</option>
									<option value="4">服务费账户</option>
								</select>
							</li>
							<li style="display: none">
								<label style="width: 100px;">结算类型：</label>
								<select name="settle_type">
									<option value="01">代理</option>
									<option value="00">商户</option>
								</select>
							</li>
							<li class="select-time">
								<label style="width: 100px;">日期：</label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="mindDate"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="maxDate"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.table.exportExcel()" >
					<i class="fa fa-download"></i> 结算导出
				</a>
				<a class="btn btn-success" onclick="$.table.importExcel()" >
					<i class="fa fa-upload"></i> 出款回更
				</a>
				<a class="btn btn-danger" onclick="ckReject()" >
					<i class="fa fa-remove"></i> 出款打回
				</a>
				<a class="btn btn-success" onclick="$.table.importTemplate()" >
					<i class="fa fa-download"></i> 出款模版下载
				</a>
			</div>
			
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" class="table text-nowrap"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "settleInfo/settleInfo";

		$(function()  {
            var options = {
                url: prefix + "/payList",
				exportUrl: prefix + "/exportSettleInfo",
				importUrl: prefix + "/importSettleInfo",
				importTemplateUrl: prefix + "/importTemplate",
				modalName: "结算信息",
				showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
	            clickToSelect:true,
                columns: [
					{
						checkbox: true
					},

					{
						field : 'SETTLE_SERIAL',
						title : '出款流水号'
					},
				{
					field : 'MERNO',
					title : '代理编号',
					width: "220",
					formatter:function (value, row, index) {
						return value+$.table.tooltip('[备注]'+row.REMARKS,10);
					}
				},
				{
					field : 'MER_NAME',
					title : '代理名称',
					formatter:function (value, row, index) {
						return value;
					}
				},
				{
					field : 'NATURE',
					title : '账户类型',
					formatter: function(value, row, index) {
						if ("1" == value){
							return '<span style="color:blue;">对公</span>';
						}else if("2" == value){
							return '<span style="color:green;">对私</span>';
						}else{
							return '<span style="color:red;">未知</span>';
						}
					}
				},
				{
				    field : 'BANK_NAME',
				    title : '开户行名称',
					formatter:function (value, row, index) {
						return $.table.tooltip(value,10);
					}
				},
				{
					field : 'SCREEN_NAME',
					title : '结算人'
				},
				{
					field : 'SHOW_SCREENNUM',
					title : '结算卡(账户)'
				},
				{
					field : 'SCREEN_NUM',
					title : '结算卡(出款)'
				},
				{
					field : 'TMONEY',
					title : '结算金额(元)',
					formatter: function(value, row, index) {
						return $.table.rmbFormatter(value*0.01);
					}
				},
				{
					field : 'AMOUNT',
					title : '总交易金额(元)',
					formatter: function(value, row, index) {
						return $.table.rmbFormatter(value*0.01);
					}
				},

				{
					field : 'CHARGE',
					title : '总手续费(元)',
					formatter: function(value, row, index) {
						return $.table.rmbFormatter(value*0.01);
					}
				},
				{
					field : 'COUNTS',
					title : '总笔数'
				},
				{
					field : 'AUDITDATE',
					title : '出款日期'
				},
				{
					field : 'SETTLE_STATE',
					title : '出款状态',
					formatter: function(value, row, index) {
						if ("0"==value){
							return '<span style="color:blue;">待处理</span>';
						}else if("1"==value){
							return '<span style="color:green;">出款成功</span>';
						}else if("-2"==value){
							return '<span style="color:red;">出款失败</span>';
						}else if("-3"==value){
							return ' <span style="color:red;">冻结</span>';
						}else if("-4"==value){
							return ' <span style="color:red;">出款打回</span>';
						}else if("-1"==value){
							return ' <span style="color:blue;">已上送</span>';
						}else{
							return ' <span style="color:red;">未知</span>';
						}
					}
				},
				{
					field: 'ACC_TYPE',
					title: '账户类型'
				},
]
            };
            $.table.init(options);
        });
		
		function ckReject() {
			var ids = $.table.selectColumns("ID");
			$.modal.confirm("确定要进行出款打回操作吗?", function() {
				$.post(prefix + "/saveCkReject",{"ids":ids.toString()},function(result){
					if (result.code == '0'){
						$.table.refresh();
						$.modal.msgSuccess(result.msg);
						return;
					} else {
						$.modal.msgError(result.msg);
						return;
					}
				});
			})
		}

    </script>
	 <!-- 导入区域 -->
	 <script id="importTpl" type="text/template">
		 <form enctype="multipart/form-data" class="mt20 mb10">
			 <div class="col-xs-offset-1">
				 <input type="file" id="file" name="file"/>
				 <!--<div class="mt10 pt5">
					 &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
				 </div>-->
				 <font color="red" class="pull-left mt10">
					 提示：仅允许导入“xls”或“xlsx”格式文件！
				 </font>
			 </div>
		 </form>
	 </script>
</body>
</html>